
ac.buff('撼地拳套'){
    on_add = function(self)
		local unit = self.owner
        self:gc(unit:add('每秒力量',1))
    end,
}

ac.buff('追风者长靴'){
    on_add = function(self)
		local unit = self.owner
        self:gc(unit:add('每秒敏捷',1))
    end,
}

ac.buff('魔导吊坠'){
    on_add = function(self)
		local unit = self.owner
        self:gc(unit:add('每秒智力',1))
    end,
}

ac.item('邪恶召唤书'){
    cool = 40,
    used_flag = false,
    item_type = 'permanent',
    cooling_flag = false,
}

ac.buff('邪恶召唤书'){
    model1 = [[Units\Demon\Infernal\InfernalBirth.mdl]],
    on_add = function(self)
        local hero = self.owner
        self:gc(hero:event '单位-攻击命中'(function(_,_,target)
            if self.item:is_cooling()==false then
                self.item:active_cd()
                local point = target:get_point()
                point:add_effect(self.model1):remove()
                ac.wait(1000,function()
                    local unit = hero:create_unit('召唤物-地狱火',point,0)
                    unit.title = '地狱火'
                    unit.owner_unit = hero
                    unit_add_life2(unit)
                    jass.SetUnitAcquireRange(unit.handle, hero:get('攻击距离'))
                    unit:set('攻击间隔',hero:get('攻击间隔'))
                    unit:set('基础攻击',hero:get('攻击'))
                    unit:set('攻击速度',hero:get('攻击速度'))
                    unit:set('生命上限',hero:get('生命上限')*0.5)
                    unit:set('基础护甲',hero:get('基础护甲'))

                    unit:add_buff('召唤物'){time = 15}
                end)
            end
        end))
    end,
}



ac.buff('多重箭'){
    on_add = function(self)
		local unit = self.owner
        self.data1 = 0
        self:gc(ac.loop(1000,function()
            local num = unit:get('多重数量') * 5
            unit:add('多重伤害',num - self.data1)
            self.data1 = num
        end))
    end,
    on_remove = function(self)
		local unit = self.owner
        unit:add('多重伤害', - self.data1)
    end,
}



ac.buff('弹射球'){
    on_add = function(self)
		local unit = self.owner
        self.data1 = 0
        self:gc(ac.loop(1000,function()
            local num = unit:get('弹射次数') * 5
            unit:add('弹射伤害',num - self.data1)
            self.data1 = num
        end))
    end,
    on_remove = function(self)
		local unit = self.owner
        unit:add('弹射伤害', - self.data1)
    end,
}


ac.buff('王之宝库'){
    on_add = function(self)
		local unit = self.owner
        local player = unit.owner
        self:gc(unit:event '英雄-击杀单位'(function(trg)
            self.item:add_count(1)
            if self.item:get_count()>=500 then
                local name = random_item_name(math.random(1,3))
                local item = collate_item(unit,name)
                player:send_msg(('王之宝库：获得%s'):format(item:get_title()))
                self.item:set_count(0)
            end
        end))
    end,
}